# -*- coding: utf-8 -*-

from __future__ import print_function

import matplotlib.font_manager as mfm
import matplotlib.pyplot as plt

from gen_plate import *

# reload(sys)
# sys.setdefaultencoding("utf-8")

if __name__ == '__main__':

	# print(os.getcwd())
	g = GenPlate(font_ch_plate, font_en_plate, plate_bg_dir)
	text, image = g.gen_one()

	# 指定默认字体
	myfont = mfm.FontProperties(fname = '/System/Library/Fonts/PingFang.ttc')

	f = plt.figure()
	ax = f.add_subplot(111)
	# plt.title(text.decode(encoding="utf-8"),fontproperties=myfont)
	plt.title(text,fontproperties=myfont)
	# ax.text(0.1, 0.9, text.encode('utf-8') , ha='center', va='center', transform=ax.transAxes)
	plt.imshow(image, cmap = plt.cm.gray)

	plt.show()